#ifndef MMA8451_H
#define MMA8451_H

#include "types.h"
#include "stm32f10x.h"


typedef enum {
	GRAVITY_RANGE_2G,
	GRAVITY_RANGE_4G,
	GRAVITY_RANGE_8G,
} GravitySensorRange_t;

typedef enum {
	GRAVITY_SAMPLING_800HZ = 0,
	GRAVITY_SAMPLING_400HZ = 1,
	GRAVITY_SAMPLING_200HZ = 2,
	GRAVITY_SAMPLING_100HZ = 3,
	GRAVITY_SAMPLING_50HZ  = 4,
	GRAVITY_SAMPLING_12HZ5 = 5,
	GRAVITY_SAMPLING_6HZ25 = 6,
	GRAVITY_SAMPLING_1HZ56 = 7,
} GravitySensorSamplingFrequency_t;

extern int SelectGravitySensorRange(GravitySensorRange_t range);
extern int OpenGrayvitySensor(void);
extern int CloseGravitySensor(void);
extern int WriteGravitySensorRegister(uint8_t address, uint8_t value);
extern int ReadGravitySensorRegister(uint8_t address);
extern int isGravitySensorEnable(void);
extern void OutputGravitySensorData(void);
extern int SetGravitySamplingFreqency(GravitySensorSamplingFrequency_t freq);
  
#endif // ifndef MMA8451_H

